package dome2;

import java.util.Arrays;

/**
 * Created with IntelliJ IDEA.
 * Description: 拆箱和装箱代码测试
 * User: 王圆豪
 * Date: 2024-07-08
 * Time: 21:38
 */
public class Test {
    public static void main(String[] args) {
        MyArray<C> a = new MyArray<>();
//        MyArray<B> b = new MyArray<>();

        a.myArray[0] = new C(1,2);
        a.myArray[1] = new C(2, 1);
        Arrays.sort(a.myArray);
        System.out.println(a);

        MyArray<A> a1 = new MyArray<A>();
    }
    public static void main2(String[] args) {
        Integer a = 100;
        Integer b = 100;
        System.out.println(a == b);

        Integer c = 200;
        Integer d = 200;
        System.out.println(c == d);

        System.out.println("=========");

        double e = 100;
        Double f = Double.valueOf(e);

        char g = 'c';
        Character h = Character.valueOf(g);

        float a1 = 1;
        Float a2 = Float.valueOf(a1);

        boolean b1 = false;
        Boolean b2 = Boolean.valueOf(b1);
        Boolean b3 = false;
        Boolean b4 = false;
        System.out.println(b4 == b3);

        byte c1 = 1;
        Byte c2 = Byte.valueOf(c1);
        System.out.println((int)c1);
        System.out.println(c2);

        short s1 = 1;
        Short s2 = Short.valueOf(s1);

        long l1 = 1;
        Long l2 = Long.valueOf(l1);
    }
    public static void main1(String[] args) {
        // 拆箱/拆包
        Integer a = 10;
        int b = a.intValue();//显示拆箱
        int c = a;//自动拆箱
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        // 装箱/装包
        int e = 5;
        Integer f = e;//自动装箱
        Integer g = Integer.valueOf(e);//显示装箱
        System.out.println(e);
        System.out.println(f);
        System.out.println(g);
    }
}
